<?php
/*code here*/
/* Redirect user if they already logged */
if(Auth::hasAuth('current_user')){
    //$this->view->current_user = Auth::getAuth('current_user');

}
else{
    header('location: /');
}

    $auth = Auth::getAuth('current_user');
    $user_level_id = $auth['user_level_id'];
    $db = new Database();
    $fs = new functions;
        // Allow User View
        functions::redirection_user($user_level_id);
/*code here(end)*/

$search = new Search();
if(isset($_GET['id'])){
	$form_id = $fs->base_encode_decode("decrypt", $_GET['id']);
	$forms = $db->query("SELECT * FROM tb_workspace WHERE id = {$db->escape($form_id)}", "row");
	$result = $search->getManyRequest("",0,$form_id,0,1,array());
	$countReq = count($result);
	if(!$search->getFormPrivacyUsers($forms['form_authors']) && !$search->getFormPrivacyUsers($forms['form_viewers']) && $countReq==0){
		// echo "asdasd";
		// header("location:/user_view/error");
		header("location:/user_view/home");
	}
}

$this->setLayout();